package com.zhang.modules.mianShi.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.zhang.common.jpa.entity.BaseEntity;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.time.Instant;
import java.util.Date;

@AllArgsConstructor
@NoArgsConstructor
@Getter
@Setter
@Entity(name = "Equipment")
@Table(name = "app_equipment")
public class Equipment extends BaseEntity {

    @Size(max = 255)
    @NotNull
    @Column(name = "equipment_code", nullable = false)
    private String equipmentCode;

    @Size(max = 255)
    @NotNull
    @Column(name = "equipment_name", nullable = false)
    private String equipmentName;

    @NotNull
    @Column(name = "is_default", nullable = false)
    private Boolean isDefault = false;

    @Size(max = 255)
    @Column(name = "master_code")
    private String masterCode;

    @Size(max = 255)
    @NotNull
    @Column(name = "system_id", nullable = false)
    private String systemId;

    @Size(max = 255)
    @NotNull
    @Column(name = "equipment_category", nullable = false)
    private String equipmentCategory;

    @Size(max = 255)
    @NotNull
    @Column(name = "equipment_model", nullable = false)
    private String equipmentModel;

    @Size(max = 255)
    @NotNull
    @Column(name = "manufacturer", nullable = false)
    private String manufacturer;

    @Size(max = 255)
    @NotNull
    @Column(name = "sn", nullable = false)
    private String sn;

    @NotNull
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "pd", nullable = false)
    private Date pd;

    @Size(max = 255)
    @NotNull
    @Column(name = "debug_units", nullable = false)
    private String debugUnits;

    @Size(max = 255)
    @NotNull
    @Column(name = "install_num", nullable = false)
    private String installNum;

    @Size(max = 255)
    @NotNull
    @Column(name = "install_pos", nullable = false)
    private String installPos;

    @NotNull
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @Column(name = "remove_date", nullable = false)
    private Date removeDate;

    @Size(max = 255)
    @NotNull
    @Column(name = "equipment_rating", nullable = false)
    private String equipmentRating;

    @Size(max = 255)
    @NotNull
    @Column(name = "equipment_status", nullable = false)
    private String equipmentStatus;

}